package com.ruoyi.web.tdm.common;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.web.tdm.domain.TdmShengWuShouTi;
import com.ruoyi.web.tdm.service.ITdmShengWuShouTiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 生物受体  核受体 Controller
 * nucleus
 * @author ly
 * @date 2022-03-14
 */
@RestController
@RequestMapping("/tdm/TdmShengWuShouTiNucleus")
public class TdmShengWuShouTiNucleusController extends BaseController
{
    @Autowired
    private ITdmShengWuShouTiService tdmShengWuShouTiService;

    /**
     * 查询ID-09 -21 生物受体列表
     */
//    @PreAuthorize("@ss.hasPermi('tdm:TdmShengWuShouTi:list')")
    @GetMapping("/list")
    public TableDataInfo list(TdmShengWuShouTi tdmShengWuShouTi)
    {
        startPage();
        List<TdmShengWuShouTi> list = tdmShengWuShouTiService.selectTdmShengWuShouTiNucleusList(tdmShengWuShouTi);
        return getDataTable(list);
    }

    /**
     * 导出ID-09 -21 生物受体列表
     */
//    @PreAuthorize("@ss.hasPermi('tdm:TdmShengWuShouTi:export')")
    @Log(title = "ID-09 -21 生物受体", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TdmShengWuShouTi tdmShengWuShouTi)
    {
        List<TdmShengWuShouTi> list = tdmShengWuShouTiService.selectTdmShengWuShouTiEnzymeLinkList(tdmShengWuShouTi);
        ExcelUtil<TdmShengWuShouTi> util = new ExcelUtil<TdmShengWuShouTi>(TdmShengWuShouTi.class);
        util.exportExcel(response, list, "ID-09 -21 生物受体数据");
    }

    /**
     * 获取ID-09 -21 生物受体详细信息
     */
//    @PreAuthorize("@ss.hasPermi('tdm:TdmShengWuShouTi:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(tdmShengWuShouTiService.selectTdmShengWuShouTiById(id));
    }

    /**
     * 新增ID-09 -21 生物受体
     */
//    @PreAuthorize("@ss.hasPermi('tdm:TdmShengWuShouTi:add')")
    @Log(title = "ID-09 -21 生物受体", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TdmShengWuShouTi tdmShengWuShouTi)
    {
        return toAjax(tdmShengWuShouTiService.insertTdmShengWuShouTiNucleus(tdmShengWuShouTi));
    }

    /**
     * 修改ID-09 -21 生物受体
     */
//    @PreAuthorize("@ss.hasPermi('tdm:TdmShengWuShouTi:edit')")
    @Log(title = "ID-09 -21 生物受体", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TdmShengWuShouTi tdmShengWuShouTi)
    {
        return toAjax(tdmShengWuShouTiService.updateTdmShengWuShouTi(tdmShengWuShouTi));
    }

    /**
     * 删除ID-09 -21 生物受体
     */
//    @PreAuthorize("@ss.hasPermi('tdm:TdmShengWuShouTi:remove')")
    @Log(title = "ID-09 -21 生物受体", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tdmShengWuShouTiService.deleteTdmShengWuShouTiByIds(ids));
    }
}
